import 'package:flutter/material.dart';
import 'package:tree_hole/res/QuestionData.dart';
import 'SingleQuestionPage.dart';

//每日问题主页
  class QuestionPage extends StatelessWidget{
    String token;
    QuestionPage(this.token);
  Widget build(BuildContext context){
    return ListView(
      children: QuestionData.map((value){
        return InkWell(
          child: Card(
            margin: EdgeInsets.all(20),
            child: Column(
              children:<Widget> [
                AspectRatio(
                  aspectRatio: 13/9,
                  child:Image.asset(value["picture"],fit: BoxFit.cover,) ,
                ),
                ListTile(
                  leading: CircleAvatar(
                    backgroundImage: NetworkImage("https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3855998524,74332752&fm=26&gp=0.jpg"),
                  ),
                  title: Text(value["question"]),
                  subtitle: Text(value["subtitle"]),
                )
              ],
            ),
          ),
          onTap: () {Navigator.push(context, new MaterialPageRoute(builder: (context) => SingleQuestionPage(value,token: this.token,)));},
        );
      }).toList(),
    );
  }
}